html {
  font-size: $font-size-base;
  scroll-behavior: smooth;
  touch-action: manipulation;
  height:100%;
  width:100%;
}

body {
  height:100%;
  width:100%;
  color: $body-font-color;
  background: $body-background;

  letter-spacing: 0.33px;
  font-weight: $body-font-weight;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  box-sizing: border-box;
  * {
    box-sizing: inherit;
  }
}

h1,
h2,
h3,
h4,
h5 {
  font-weight: 500;
}

a {
  text-decoration: none;
  color: $blue;
}

img {
  vertical-align: baseline;
}

:focus{
  outline:none
}

nav ul {
  padding: 0;
  margin: 0;
  list-style: none;
}

aside nav ul li{
  position: relative;
}

// Responsive styles
aside nav,
.book-page,
.book-header aside,
.book-search-inner,
.markdown {
  transition: 0.2s ease-in-out;
  transition-property: transform, margin, opacity, visibility;
  will-change: transform, margin, opacity;
}

.fixed{
  @include fixed
}

//card
.book-card{
  display:flex;
  border: 1px solid $border-color;
  margin: 0;
  padding: 0;
  position: relative;
  align-self: stretch;
  box-shadow: 0 3px 8px 0 rgba(116, 129, 141, 0.1);
  transition: border 250ms ease;
  align-items: center;
  justify-self: stretch;
  border-radius: 3px;
  flex-direction: row;
  text-decoration: none;
  background-color: #FFFFFF;
  page-break-inside: avoid;
  cursor:pointer;
  .book-card-body,.book-card-icon{
    color:inherit;
  }
  &:hover{
    color:$blue;
    border-color:$blue;
  }
}
.book-card-icon{
  flex: 0 0 auto;
  color: $gray;
  margin: 0;
  display: block;
  padding: 1rem;
  font-size: 1.5rem;
  transition: color 250ms ease;
  &:first-child{
    padding-right:0;
  }
  &:last-child{
    padding-left:0;
  }
  svg{
    width:1.5rem;
    height:1.5rem;
    vertical-align: middle;
  }
}
.book-card-body{
  flex: 1;
  margin: 0;
  display: block;
  padding: 1rem;
  color:$black;
}
.book-card-hint{
  color: $gray;
  margin: 0;
  display: block;
  padding: 0;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.625;
}
.book-card-title{
  margin: 0;
  display: block;
  padding: 0;
  transition: color 250ms ease;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
}

//icon

.book-icon-wrapper{
  display:flex;
  width:30px;
  height:30px;
  align-items: center;
  justify-content: center;
}
.book-icon{
  svg{
    width:1rem;
    height:1rem;
  }
}
.book-icon-big{
  svg{
    width : 1.1rem;
    height : 1.1rem;
    vertical-align: middle;
  }
}
.clear-search {
  display: none;

  &.display {
    display: flex;
  }
  &:hover{
    svg path {
      fill: #8d9199;
    }
  }
}
.close-search{
  position: relative;
  &:hover{
    svg path{
      fill: #338fe5;
    }
    .tooltip {
      display: block;
    }
  }
  .tooltip{
    display: none;
    position: absolute;
    left: -56px;
    top: 0px;
    width: 50px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    background: rgba(48, 48, 48, .8);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    border-radius: 3px;
    &::after{
      content: '';
      position: absolute;
      border: 6px solid transparent;
      border-left-color: rgba(48, 48, 48, .8);
      top: 8px;
      right: -12px;
    }
  }
}

.book-icon-wrapper {
  cursor:pointer;
  svg{
    filter: $icon-filter;
    cursor:pointer;
  }
}

//input
.book-input-wrapper{
  width:100%;
  display:flex;
  align-items: center;
  border-radius: $border-radius;
  height:2em;
  input{
    flex:1 1 auto;
  }
}
.book-input-addon{
  display:flex;
}


// container
.container {
  margin: 0 auto;
  flex-direction: column;
  height:100%;
}

//header
.book-header {
  width:100%;
  margin-bottom: $padding-16;
  height: 80px;
  min-width:$body-min-width;
  margin: 0;
  display: flex;
  padding: 0;
  z-index: 1;
  position: relative;
  box-shadow: 0 3px 8px 0 rgba(116, 129, 141, 0.1);
  border-bottom: 1px solid #d4dadf;
  background-color: #FFFFFF;
  flex:0 0 auto;
  >div{
    height:100%;
    width:100%;
    max-width:$container-max-width;
    margin:0 auto;
  }
}
.book-header-left{
  display:flex;
  align-items: center;
  justify-content: space-between;
  height:100%;
  width:100%;
  max-width: $menu-width;
  padding:0 $padding-16;
  position: relative;
  label {
    line-height: 0;
  }
  .book-icon-wrapper{
    display:none;
  }
}
.book-brand {
  margin-top: 0;
  flex:0 1 auto;
  width:15.625rem;
  a{
    display:block;
  }
}
.book-logo-mobile{
  display:none;
  justify-content: flex-start;
  align-items: center;
  transform: scale(0.8);
  img{
    max-width:200px;
    height:1.875rem;
  }
}
.book-logo-desktop{
  display: flex;
  justify-content: flex-start;
  align-items: center;
  img{
    max-width:200px;
    height:2rem;
  }
}
.book-logo-desktop, .book-logo-mobile{
  .divide {
    width: 1px;
    height: 20px;
    margin: 0px 20px;
    background-color: #c7c7c7;
  }
  .help-text {
    font-size: 18px;
    font-weight: 500;
    color: $text-300;
    white-space: nowrap;
  }
}
.book-header-center{
  flex: 1 1 auto;
  margin:0 5.5rem;
  height:100%;
  max-width:46.5rem;
  min-width:0;
}
.book-header-nav{
  height:100%;
  ul{
    display:flex;
    height:100%;
    :first-child{
      margin-left:0;
    }
    :last-child{
      margin-right:0;
    }
  }
  li{
      height: 100%;
      margin: 0px $padding-16;
      display: flex;
      padding: 0;
      border-top: 3px solid transparent;
      align-items: center;
      white-space: nowrap;
      border-bottom: 3px solid transparent;
      -webkit-box-align: center;
      &.active{
        border-bottom-color:$blue;
      }
  }
  a{
    font-size:$font-size-16;
    font-weight: 500;
    line-height: 1.5;
  }
}

.book-header-right{
  flex:0 0 auto;
  width:$toc-width;
  padding:0 $padding-16;
  position: relative;
}


//main
.book-main{
  flex:1 1 auto;
  min-width:$body-min-width;
}

//menu
.book-menu {
  flex: 0 0 auto;
  width:calc((100% - #{$container-max-width}) / 2 + #{$menu-width});
  padding-left:calc((100% - #{$container-max-width}) / 2);
  background:$gray-100;
  min-width: $menu-width;
  font-size: $font-size-14;
  display: flex;
  nav {
    width: $menu-width;
    padding: 2rem 0 $padding-16;
    background:$gray-100;
    border-right:1px solid $border-color;
    overflow:auto;
    display:flex;
    flex-direction: column;
  }
}

.book-menu-header{
  display:none;
  height:60px;
  align-items: center;
  margin-bottom:$padding-16;
  padding: 0 11px;
  z-index: 1;
  position: relative;
  box-shadow: 0 3px 8px 0 rgba(116, 129, 141, 0.1);
  border-bottom: 1px solid #d4dadf;
  background-color: #FFFFFF;
  color:$gray-600;
  flex:0 0 auto;
  .book-icon-wrapper{
    width:auto;
  }
}
.book-menu-tree{
  flex:1 1 auto;
  padding-left: 1.5rem;
  &>ul{
    margin-bottom:1.5rem;
    &:last-child{
      margin-bottom:0;
    }
  }
}
.book-section-flat {
  margin-top: 1.5rem;
  margin-bottom:1.5rem;
  &:first-child {
    margin-top: 0;
  }
  &:last-child{
    margin-bottom:0;
  }
}
.book-menu-children .book-menu-children,.book-hugo-menu-children{
  margin-left: 1rem;
  .book-menu-item-inner{
    border-left-color:rgb(230, 236, 241)
  }
  .book-menu-item{
    color: rgb(157, 170, 182);
  }
}
.book-menu-select-version{
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin: 0px 0 20px 17px;
  width: 234px;
  text-align: right;
  .text{
    font-size: 14px;
    font-weight: 500;
    color: $text-300;
    margin-right: 10px;
  }
  .select-version{
    position: relative;
    z-index: 999;
    flex: 1;
    
    .select-btn{
      width: 100%;
      height: 26px;
      border-radius: 3px;
      border: solid 1px rgba(144, 144, 144, 0.5);
      background: #fff;
      color: $text-600;
      line-height: 24px;
      padding-left: 10px;
      cursor: pointer;
  
      display: flex;
      justify-content: space-between;
      align-items: center;
      &:focus{
        border-color: #338fe5;
        box-shadow: 0px 0px 2px 2px rgba(51, 143, 229, .1);
      }
      svg.arrow {
        transform: rotate(90deg);
        font-size: 14px;
        color: $text-600;
      }
    }
    .select-options{
      display: none;
      width: 156px;
      position: absolute;
      top: 30px;
      right: 0;
      z-index: 10;
      background: #fff;
      border-radius: 3px;
      box-shadow: 0 12px 24px -6px rgba(48, 48, 48, 0.15), 0 0 1px 0 rgba(48, 48, 48, 0.25);
      max-height: 220px;
      overflow-y: auto;
      padding: 5px 0;
      li{
        width: 100%;
        padding: 6px 10px;
        line-height: 20px;
        text-align: left;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: space-between;
        color: #303030;
        font-size: 14px;
        line-height: 22px;
        &.selected{
          color: #338fe5;
        }
        &:hover{
          background: #f8f8f8;
        }
      }
    }

    &.active{
      .select-options{
        display: block;
      }
    }
  }
}
.book-menu-group-item{
  color:$gray;
  font-size:14px;
}
.book-menu-item{
  display:block;
  color:$menu-color;
}
a.book-menu-item-inner,a.book-menu-group-item-inner{
  border:1px solid transparent;
  border-right:none;
  padding:0.4375rem 1.5rem 0.4375rem 1rem;
  display:flex;
  word-wrap: break-word;
  color:inherit;
  &.active{
    color:$blue;
    background:#fff;
    border-color:rgb(230, 236, 241);
  }
  &.collapsed-open svg{
    transform: rotate(90deg);
  }
}
a.book-menu-item-inner:hover,a.book-menu-group-item-inner.hascontent:hover{
  background: rgb(230, 236, 241);
}

.book-menu-item-text{
  flex:1 1 auto;
  line-height:1.5;
  font-weight: 500;
  font-size: 14px;
  word-break: break-word;
}
.book-menu-item-icon{
  color: $gray;
  cursor: pointer;
  margin: -0.5rem;
  display: block;
  padding: 0.5rem;
  position: relative;
  line-height:1;
  margin-left:0;
  flex:0 0 auto;
  align-self: center;
  svg{
    width:1.125rem;
    height:1.125rem;
    vertical-align: middle;
  }
}

//page
.book-page {
  flex-grow: 1;
  max-width: $page-max-width;
  margin:0 5.5rem;
  padding-bottom:4rem;
  min-width:0;
}

.book-page-header{
  padding:2.5rem 0;
  border-bottom: 2px solid $border-color;
  margin:0 auto 2rem;
}
.book-page-title-container{
  display:flex;
  align-items: center;
  justify-content: space-between;
  .book-icon-wrapper{
    color:rgb(157, 170, 182);
  }
}
.book-page-title{
  flex: 1 1 auto;
  padding-right:$padding-16;
  display:block;
  h1{
    margin:0;
    line-height:1.5
  }
}
.book-page-description{
  color: #74818D;
  width: 100%;
  border: none;
  margin: 8px 0px 0px 0px;
  resize: none;
  display: block;
  outline: none;
  padding: 0;
  background: none;
  min-height: 19px;
  overflow-x: hidden;
  border-radius: 3px;
  letter-spacing: 0.0em;
  font-size:$font-size-16;
  line-height:1.625;
}


.book-post {
  margin-bottom: $padding-16 * 3;
}

.book-overlay{
  position: fixed;
  background:rgba(24, 48, 85, 0.3);
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index:2;
}
.book-zoom-container{
  position: fixed;
  background:$white;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index:2;
  display:flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 250ms ease-in-out;
  &.hidden{
    display:none;
    opacity: 0;
  }
  img{
    max-height:100%;
    max-width: 100%;
    cursor: zoom-out;
  }
}



//search
#search-control:checked ~ main {
  .book-search-overlay {
    display: block;
  }
  .book-search{
    visibility: initial;
  }
  .book-search-inner {
    transform: translateX(-$search-width);
    box-shadow: rgba(0, 0, 0, 0.14) 0px 0px 4px, rgba(0, 0, 0, 0.28) 0px 4px 8px;;
    border-right:1px solid rgb(230, 236, 241);
  }
}

.book-search {
  position: absolute;
  visibility: hidden;
  border-bottom: 1px solid transparent;
  margin-inline-start: 100%;
  font-size: $font-size-base; 
  .book-search-inner{
    @include fixed;
    width:$search-width;
    z-index:3;
    background:#fff;
  }
  
  .book-input-wrapper{
    flex: 1 1 auto;
    width:initial;
  }
  .book-search-spinner {
    position: absolute;
    top: 0;
    margin: $padding-8;
    margin-inline-start: calc(100% - #{$padding-16 + $padding-8});

    width: $padding-16;
    height: $padding-16;

    border: $padding-1 solid transparent;
    border-top-color: $body-font-color;
    border-radius: 50%;

    @include spin(1s);
  }

  small {
    opacity: 0.5;
  }

  .divide{
    margin: 0 10px;
  }
}
.book-search-header{
  height:80px;
  align-items: center;
  padding: 0 11px;
  z-index: 1;
  position: relative;
  box-shadow: 0 3px 8px 0 rgba(116, 129, 141, 0.1);
  border-bottom: 1px solid #d4dadf;
  background-color: #FFFFFF;
  color:$gray-600;
  display:flex;
}
.book-search-input{
  padding: $padding-8;

  border: 0;
  color: $body-font-color;
  &:required + .book-search-spinner {
    display: block;
  }
}
#book-search-results{
  padding: 10px 0;
  li {
    text-align: left;
    padding: 10px 15px;

    &:hover {
      background: rgba(237, 239, 242, 0.5);
    }

    a {
      display: block;
    }
    
    .title-wrap{
      padding: 10px 0px 5px;
    }

    .left-line {
      width: 2px;
      height: 14px;
      margin: 5px 5px 5px 0;
      background: #242629;
      display: inline-block;
      vertical-align: top;
    }

    .title {
      line-height: 24px;
      font-size: 14px;
      color: #1d1e20;
      display: inline-block;
      vertical-align: top;
      width: calc(100% - 20px);
      font-weight: 500;

      strong {
        font-weight: 500;
        color: #f24e24;
      }
    }

    .description {
      font-size: 12px;
      line-height: 1.5;
      padding-left: 7px;
      color: #45464a;
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
      strong {
        color: #f24e24;
        font-weight: 400;
      }
    }
  }
  .empty{
    min-height: calc(100vh - 100px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c6f75;
    font-size: 14px;
    &:hover{
      background: transparent;
    }
  }
}


//toc
.book-popover-toc,.book-topdf-popover{
  max-width: 260px;
  min-width: 224px;
  max-height: 233px;
  margin: -5px -9px;
  padding: 0px;
  overflow: hidden;
  .book-popover-toc-inner,.book-topdf-popover-inner{
    display: block;
    overflow-x: hidden;
    overflow-y: overlay;
    flex: 1 1 0%;
    margin: 0px;
    padding: 0.75rem 0;
  }
}
.book-page-aside {
  display:none;
  flex: 0 0 auto;
  width: $toc-width;
  font-size: $font-size-12;
  nav {
    width: $toc-width;
  }

  img {
    height: 1em;
  }
  .book-topdf-header{
    cursor:pointer;
    &:hover{
      color:$blue;
    }
  }
}
.book-page-aside-inner{
  width: $toc-width;
  height: 100%;
  padding-top:2rem;
  overflow: auto;
}
.book-topdf,.book-toc{
  margin-bottom:1.5rem;
  position:relative;
  &:before{
    @include split-line;
    height:100%;
    left:0;
  }
}
.book-topdf-header{
  padding:0.25rem 1rem;
}
.book-topdf-header,.book-toc-header{
  display:flex;
  align-items: center;
  color:rgb(157, 170, 182);
  padding-left:24px;
  font-size:10px;
  font-weight:700;
  line-height:1;
  letter-spacing: 1.2px;
  .book-icon-wrapper{
    height:initial;
    width:initial;
    margin-right:0.5rem;
    svg{
      width: 1rem;
      height:1rem;
    }
  }
}
.book-toc-header{
  margin-bottom:0.5rem
}
#TableOfContents{
  ul ul ul{
    padding-left:1rem;
  }
  a{
    padding:0.25rem 1rem 0.25rem 2rem;
    font-size:12px;
    line-height:1.5;
    display: block;
    color:rgb(116, 129, 141);
    font-weight: 500;
    &:hover{
      color:$blue;
      opacity: 1;
    }
  }
}
//foot
.book-footer {
  margin-top:4rem;
  font-size: $font-size-14;

  img {
    height: 1em;
    margin-inline-end: $padding-8;
  }
}

.book-footer-external{
  margin: 0;
  padding: 0;
  border-top: 2px solid $border-color;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
}

.book-page-navgation-inner{
  display:grid;
  width: auto;
  grid-column-gap: 24px;
  grid-template-rows: auto;
  grid-template-areas: "previous next";
  grid-template-columns: 1fr 1fr;
  a{
    color:$black;
    &:hover .book-card-icon{
      color:$blue;
    }
  }
  .book-card-icon{
    color:$gray;
  }
}
.book-page-navgation-inner.book-page-unique{
  grid-row-gap: 24px;
  grid-template-areas:
      "next"
      "previous";
  grid-template-columns: 1fr;
}

.book-page-prev{
  text-align: right;
  grid-area: previous;
}
.book-page-next{
  grid-area: next;
}


.book-blank{
  margin: 0px;
  padding: 2.5rem 0px;
  a.book-card{
    margin: 0;
    padding: 1rem;
    color: $black;
    flex-direction: column;
    &:visited{
      color:unset
    }
    &:hover{
      text-decoration: none;
      color:$blue;
    }
  }
  .book-card-title{
    width:100%;
  }
  .book-card-hint{
    margin: 8px 0px 0px;
    width:100%;
    word-break: break-all;
  }
}
.book-blank-hint{
  margin: 0px 0px 0.5rem;
  padding: 0px;
}
.book-blank-section{
  width: 100%;
  margin: 24px 0px;
  display: grid;
  padding: 0px;
  gap: 24px;
  justify-content: center;
  -webkit-box-pack: center;
  grid-template-rows: auto;
  grid-template-columns: calc(50% - 8px) calc(50% - 8px);
}
//comments
.book-comments {
  margin-top: $padding-16;
}

// .book-languages {
//   position: relative;
//   overflow: visible;

//   padding: $padding-16;
//   margin: -$padding-16;

//   ul {
//     margin: 0;
//     padding: 0;
//     list-style: none;

//     li {
//       white-space: nowrap;
//       cursor: pointer;
//     }
//   }

//   &:hover,
//   &:focus,
//   &:focus-within {
//     .book-languages-list {
//       display: block;
//     }
//   }

//   .book-languages-list {
//     display: none;

//     position: absolute;
//     bottom: 100%;
//     left: 0;
//     padding: $padding-8 0;

//     background: $body-background;
//     box-shadow: 0 0 $padding-4 rgba(0, 0, 0, 0.1);

//     li img {
//       opacity: 0.25;
//     }

//     li.active img,
//     li:hover img {
//       opacity: initial;
//     }

//     a {
//       color: inherit;
//       padding: $padding-8 $padding-16;
//     }
//   }
// }

.book-home {
  padding: $padding-16;
}
.book-pdf-exports{
  list-style: none;
  margin:0;
  padding:0;
  a{
    padding: .25rem 1rem .25rem 2rem;
    font-size: 12px;
    line-height: 1.5;
    display: block;
    color: #74818d;
    font-weight: 500;
    &:hover{
      color:$blue;
    }
  }
}



// #toc-control{
//   display:inline
// }

// #toc-control:focus ~ main label[for="toc-control"] {
//   @include outline;
// }

// #toc-control:checked ~ main {
//   .book-header aside {
//     display: block;
//   }
// }

@media screen and (max-width: $mobile-breakpoint) {
  .book-header {
    @include fixed;
    z-index: 1;
  }
  .book-brand{
    width:initial;
    padding:0 1.5rem;
  }
  .book-header-center,
  .book-header-right{
    display:none
  }
  .book-header-left{
    max-width: unset;
    &:after{
      display:none;
    }
    .book-icon-wrapper{
      display:flex;
    }
  }
  .book-page{
    margin:0 auto;
    padding:0 1.5rem 1.5rem;
  }
  .book-menu {
    visibility: hidden;
    margin-inline-start: -$menu-width;
    font-size: $font-size-base; 
    nav{
      @include fixed;
      z-index: 3;
    }
  }

  .book-main{
    padding-top:80px;
  }

  #menu-control{
    display: inline;
  }

  #menu-control:checked ~ main {
    .book-menu {
      visibility: initial;
    }

    .book-menu nav {
      transform: translateX($menu-width);
      box-shadow: rgba(0, 0, 0, 0.14) 0px 0px 4px, rgba(0, 0, 0, 0.28) 0px 4px 8px;;
      border-right:1px solid rgb(230, 236, 241);
    }

    .book-menu-overlay {
      display: block;
    }
  }

  //for RTL support
  body[dir="rtl"] #menu-control:checked + main {
    .book-menu nav {
      transform: translateX(-$menu-width);
    }
  }
}

@media screen and (max-width: $pad-breakpoint) {
  .book-header{
    height:60px;
  }
  .book-logo-mobile{
    display:flex;
  }
  .book-logo-desktop{
    display:none;
  }
  .book-menu{
    nav{
      padding-top:0;
    }
  }
  .book-menu-header{
    display: flex;
    margin-bottom:2rem;
  }
  .book-search-header{
    height:60px;
  }
  .book-main{
    padding-top:60px;
  }
  .book-page-navgation-inner{
    grid-row-gap: 24px;
    grid-template-areas:
        "next"
        "previous";
    grid-template-columns: 1fr;
  }
}



// Extra space for big screens
@media screen and (min-width: $big-screen-breakpoint) {
  aside.book-page-aside{
    display:block;
  }
  .book-topdf-popover{
    .book-topdf-header{
      display:none;
    }
  }
  .book-page-title-container{
    .book-icon-wrapper{
      display:none;
    }
  }
}

